package leetcode.D100.T27;

/**
 * @File Info: leetcode -- <Solution>
 * @Author: 18362
 * @Create: 2022-02-17 16:32:12 星期四
 */

class Solution {
    public int removeElement(int[] nums, int val) {
        int i = 0, j = 0;
        while(j < nums.length) {
            while(j < nums.length && nums[j] == val) {
                ++j;
            }
            if (j < nums.length)
                nums[i++] = nums[j++];
        }
        return i;
    }
}
